<!-- 开支编辑弹窗 -->
<template>
  <ele-modal
    form
    :width="400"
    :model-value="modelValue"
    title="审核详情"
    @update:modelValue="updateModelValue"
  >
    <ele-pro-table
      ref="tableRef"
      row-key="userId"
      :columns="columns"
      :datasource="datasource"
      :show-overflow-tooltip="true"
      v-model:selections="selections"
      highlight-current-row
      border
    />
  </ele-modal>
</template>

<script setup>
  import { ref } from 'vue';
  import { pageCompanyCostJudgeLogs } from '@/api/company';

  const emit = defineEmits(['done', 'update:modelValue']);

  const props = defineProps({
    /** 弹窗是否打开 */
    modelValue: Boolean,
    /** 修改回显的数据 */
    data: Object
  });

  /** 表格数据源 */
  const datasource = ({ page, limit, where, orders }) => {
    return pageCompanyCostJudgeLogs({
      ...where,
      ...orders,
      page,
      limit,
      cost_id: props.data.id
    });
  };

  /** 表格列配置 */
  const columns = ref([
    // {
    //   prop: 'id',
    //   width: 90,
    //   label: 'ID'
    // },
    {
      prop: 'judge_user',
      width: 100,
      label: '审核人'
    },
    {
      prop: 'judgeTime',
      label: '审核时间'
    }
  ]);

  /** 表单实例 */
  const tableRef = ref(null);

  /** 更新modelValue */
  const updateModelValue = (value) => {
    emit('update:modelValue', value);
  };
</script>
